/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.safetytask.mapper;

import com.koron.safetytask.domain.UserTask;
import com.koron.safetytask.domain.UserTaskFollow;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserTaskFollowMapper {
    /**
     * 新增关注
     * @param userTaskFollow
     * @return
     * @throws Exception
     */
    Integer insertFollow(@Param("userTaskFollow") UserTaskFollow userTaskFollow) throws Exception;

    Integer batchInsertFollow(@Param("followList") List<UserTaskFollow> followList);

    /**
     * 根据主键批量取消关注
     * @param idList
     * @return
     * @throws Exception
     */
    Integer deleteFollowBatch(@Param("idList") List<String> idList) throws Exception;

    /**
     * 根据关注人code获取关注的任务列表
     * @param followerCode
     * @param start
     * @param rows
     * @return
     * @throws Exception
     */
    List<UserTask> queryByFollewCode(@Param("followerCode") String followerCode, @Param("start") Integer start,
                                     @Param("rows") Integer rows,@Param("keyword") String keyword) throws Exception;

    /**
     * 根据用户code和任务id查看是否已关注该任务
     * @param followerCode
     * @param taskId
     * @return
     * @throws Exception
     */
    List<UserTaskFollow> queryByFollewCodeAndTaskId(@Param("followerCode") String followerCode, @Param("taskId") String taskId) throws Exception;

    /**
     * 根据关注人code统计关注的任务
     * @param followerCode
     * @return
     * @throws Exception
     */
    Integer countSumByFollewCode(@Param("followerCode") String followerCode,@Param("keyword") String keyword) throws Exception;
}
